essentialsdocsfandomcom-20200214-history
Defining a trainer
This page describes how to define a trainer. This includes both trainer types and individual trainers. Defining a trainer type Every trainer in the game, including the player, has a trainer type. The trainer type defines various pieces of information that are common to all trainers of that type - this includes their title (e.g. Bug Catcher, Hiker, Gym Leader), appearance (i.e. sprite), the amount of money gained from defeating them, and associated battle music. A trainer type begins with its definition. This means that it is listed in the PBS file "trainertypes.txt", so that it can be recognised by the game as a trainer type. In addition to this, a trainer type will require a number of graphics files depicting that trainer type in different ways. See below for more information. PBS file "trainertypes.txt" The PBS file "trainertypes.txt" lists all the defined trainer types in the game. Each line in this file is one separate trainer type. Every line in this file follows the same format. Firstly, here are some examples: 1,POKEMONTRAINER_Leaf,Pokémon Trainer,60,,,,Female,, 7,BEAUTY,Beauty,56,,,,Female,, 18,HIKER,Hiker,32,,,,Male,, 51,COOLCOUPLE,Cool Couple,72,,,,Mixed,48, 59,LEADER_Brock,Gym Leader,100,gymleader,,,Male,, 71,CHAMPION,Champion,100,elite,,,Male,, Each line is structured as follows, with commas separating each part: There is no difference between a trainer type used by many trainers (e.g. Bug Catcher), and a trainer type unique to just one NPC (e.g. Gym Leaders). They are all defined in exactly the same way. It is important to note that the player also has a trainer type, and it is defined in exactly the same way as any other trainer type. Player characters are defined in the PBS file "metadata.txt" to have trainer types. They do not need to be the first trainer types defined in the PBS file "trainertypes.txt", although it may help developers to keep track of them if they are. Trainer type graphics Each trainer type must have the following graphics, placed in the "Graphics/Characters" folder with the following names: * trainerXXX.png - The trainer type's battle sprite. "XXX" is either the internal name of the trainer type or its ID number padded to 3 digits (e.g. "trainer018.png" is for the Hiker trainer type). * trcharXXX.png - The trainer type's overworld charset. "XXX" is as above. Certain trainer types will also require back sprites. These include all trainer types which are used by player characters, as well as all trainer types of NPC trainers who team up with the player and fight alongside them (i.e. partner trainers). Back sprites are also placed in the "Graphics/Characters" folder, with the following name: * trbackXXX.png - "XXX" is as above. The back sprite can either be a square picture (e.g. 128x128 pixels), or it can contain 5 such square pictures arranged horizontally (e.g. 640x128 pixels). The first frame will be the regular back sprite, and the next four depict a throwing animation in order. Defining an individual trainer An individual trainer begins with its definition. This means that it is listed in the PBS file "trainers.txt", so that it can be recognised by the game as an individual trainer. PBS file "trainers.txt" The PBS file "trainers.txt" lists all the defined individual trainers in the game. Each section in this file is one separate individual trainer, where a section begins with a line containing the internal name of a trainer type and ends when the next section begins. The first three lines of each section are consistent, and are always present. After those, there are one to six additional lines, each of which defines a Pokémon owned by that trainer. Firstly, here are three examples: CAMPER Liam 5 DIGLETT,10 BONSLY,11 MAGIKARP,12 TEDDIURSA,10 SENTRET,14 #------------------------------- TEAMROCKET_M Grunt,1 1 WEEPINBELL,21 #------------------------------- LEADER_Brock Brock 2,FULLRESTORE,FULLRESTORE GEODUDE,12,,DEFENSECURL,HEADSMASH,ROCKPOLISH,ROCKTHROW,0,M,,,,20 ONIX,14,SITRUSBERRY,HEADSMASH,ROCKTHROW,RAGE,ROCKTOMB,0,M,,shiny,,20,,Rocky,,19 The lines between each section that look like #------- are unnecessary and are ignored by the game. They only exist to make the file more legible. The line information is as follows: Note that both the number of lines per section (i.e. per trainer), and the lengths of the lines describing individual Pokémon (i.e. how many commas there are in it), vary from trainer to trainer. The EVs of a trainer's Pokémon depend on its level. They are each automatically set to 1.5 times its level, up to a maximum of 85 (which is the maximum number of EVs gainable by a Pokémon divided by the number of stats (6)).